package sy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sy.pageModel.BaseEntity;
import sy.pageModel.DataGrid;
import sy.pageModel.Json;
import sy.service.ActivityServiceI;
import sy.util.StringUtil;

/**
 * Created by Administrator on 2016-07-12.
 */
@Controller
@RequestMapping("activityController")
public class ActivityController extends BaseController {

    @Autowired
    private ActivityServiceI activityService;

    @RequestMapping("/datagrid.action")
    @ResponseBody
    public DataGrid findPicAction(BaseEntity currency){
        return activityService.findBaseEntityDataGird(currency);
    }

    @RequestMapping("/add_currency.action")
    @ResponseBody
    public Json addBaseEntityAction(BaseEntity currency){
        int rows=0;
        try {
            rows=activityService.addActivityService(currency);
        } catch (Exception e) {
            e.printStackTrace();
            rows=0;
        }
        Json js= StringUtil.findJson(rows,"添加");
        return js;
    }
    @RequestMapping("/edit_currency.action")
    @ResponseBody
    public Json editBaseEntityAction(BaseEntity currency){
        int rows=0;
        try {
            rows=activityService.editActivityService(currency);
        } catch (Exception e) {
            e.printStackTrace();
            rows=0;
        }
        Json js= StringUtil.findJson(rows,"启用");
        return js;
    }
}
